package com.hb.trade.server.project.section.service.raw.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hb.core.pojo.project.section.entity.InquiryReply;
import com.hb.core.pojo.project.section.mapper.InquiryReplyMapper;
import com.hb.trade.server.project.section.service.raw.InquiryReplyService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yyx
 * @date 2022/5/16
 * @desc 专家询标投标人回复信息
 */
@Service
public class InquiryReplyServiceImpl extends ServiceImpl<InquiryReplyMapper, InquiryReply> implements InquiryReplyService {

    @Override
    public List<InquiryReply> listByInquiryId(final Long inquiryId) {
        final LambdaQueryWrapper<InquiryReply> lambdaWrapper = InquiryReply.lambdaWrapper();
        lambdaWrapper.eq(InquiryReply::getInquiryId, inquiryId);
        return this.baseMapper.selectList(lambdaWrapper);
    }

    @Override
    public Boolean deleteByInquiryId(final Long inquiryId) {
        final LambdaUpdateWrapper<InquiryReply> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.set(InquiryReply::getDeleteFlag, 1).eq(InquiryReply::getInquiryId, inquiryId);
        return this.update(updateWrapper);
    }
}
